# GASL
# Copyright Matthew F. Rienzo, 2014
#
# Based off Poolang, Copyright Matthew Caswell, 2013

# __START Package
package GASL::Exception;
# __END Package

# __START Perl
use strict;
use Data::Dumper;
require Exporter;
# __END Perl

# __START Constants
use constant {
  BIT_FIELD_UNEXPECTED => "Expected \".bits 32\", but found something else",
  SYNTAX_ERR_EOL => "Syntax error at EOL",
  FAILED_TO_OPEN_CLASS => "Couldn't open source file",
  BAD_BIT_SIZE => "Unsupported bit size in bitsize declaration",
  BAD_REG => "Bad register name",
  SYNTAX_ERROR => "Syntax error",
  NOT_IN_CMP => "Not in a comparison block",
  
};

# __END Constants

# __START Exporter
our @ISA = qw(Exporter);
our @EXPORT = qw(
  BIT_FIELD_UNEXPECTED
  SYNTAX_ERR_EOL
  FAILED_TO_OPEN_CLASS
  BAD_BIT_SIZE
  BAD_REG
  SYNTAX_ERROR
  NOT_IN_CMP
  
);
# __END Exporter

# __START Compiler

# Throw(EXCEPTION, $lineNumber) --  Throws a compiler error
sub Throw($$){
  my($e, $lineNu) = @_;
  
  die "[error] GASL: $e on line $lineNu.\n";
}

# __END Compiler
1;
